/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package treeship.core.archetype.impl;

import treeship.core.archetype.ComponentContext;

/**
 *
 * @author moonchild
 */
public class ComponentContextImpl extends ComponentContext {

    private Double weight = 1.0;
    private ArchetypeShipImpl component;

    public ComponentContextImpl(ArchetypeShipImpl as, Double w) {
        component = as;
        weight = w;
    }

    @Override
    public ArchetypeShipImpl getComponent() {
        return component;
    }

    @Override
    public Double getWeight() {
        return weight;
    }

    public void setWeight(Double weight) {
        this.weight = weight;
    }

    public void setComponent(ArchetypeShipImpl asi) {
        this.component = asi;
    }

    @Override
    public String toString() {
        if (component != null) {
            return component.getName();
        } else {
            return super.toString();
        }
    }
}
